Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JOH-48] Update pet type #17

Merged
merged 7 commits into from
Jan 10, 2024
Merged

[JOH-48] Update pet type #17

merged 7 commits into from
Jan 10, 2024

Conversation

bookpanda
Copy link
Contributor

Change made

  •  New features
  •  Bug fixes
  •  Breaking changes

Describe what you have done

  • update proto
  • pet new fields: color, pattern
  • pet field Backgroung -> Origin

New Features

Fix

  • pet dto, svc, svc test

Others

  • add PR template

Copy link

linear bot commented Jan 9, 2024

JOH-48 Pet Pagination

Copy link
Contributor

@macgeargear macgeargear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🍀, iirc the rest function in image service will be implemented right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure that what AssignPet function use for?
and iirc there're Delete Upload and AssignPet that have to implement in image service right?

Copy link
Contributor Author

@bookpanda bookpanda Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image.Upload(): uploads to S3 and create a row with url of that S3 (empty foreign key)
If upload has field petId, then petId will be filled (meaning image is created and assigned a pet at the same time)

image.AssignPet(): assigns row with specified url with that pet id (add foreign key)
image.Delete(): deletes row and object in S3

—--------------------------------
When creating pet,
For image upload, POST it, and keep the imageId from response
imageSrv.Upload(file) returns URL + imageId

For pet create, attach images’ urls into the POST request
petSrv.Create(pet + imageIds) => image.AssignPet(imageIds, petId)

—--------------------------------
When updating pet,
If delete image -> imageSrv removes the row with ID == image.id, bucket also deletes (image id got from FindByPetId fetched by client)
If upload image -> imageSrv.Upload()


Image svc in File repo is already done,
Pet svc in Backend repo still needs to use real image svc (currently they are empty [ ])
For gateway, make 3 endpoints for upload, assignpet and delete

@bookpanda bookpanda merged commit 90c7017 into dev Jan 10, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants